跳到主要内容

二进制块(Blob)

包含原始二进制数据的 Blob 资源。

字段(Fields)

size

Blob 数据的大小(以字节为单位)。

type DrawBlob = {
myBlob: Blob?,
}

function init(self: DrawBlob, context: Context): boolean
self.myBlob = context:blob('myBlob')

if self.myBlob then
print('Blob size:', self.myBlob.size, 'bytes')
end

return true
end

return function(): Node<DrawBlob>
return {
myBlob = nil,
init = init,
}
end

name

Blob 资源的名称。

type DrawBlob = {
myBlob: Blob?,
}

function init(self: DrawBlob, context: Context): boolean
self.myBlob = context:blob('myBlob')

if self.myBlob then
print('Blob name:', self.myBlob.name)
end

return true
end

return function(): Node<DrawBlob>
return {
myBlob = nil,
init = init,
}
end

data

作为 buffer 的原始二进制数据。

type DrawBlob = {
myBlob: Blob?,
}

function init(self: DrawBlob, context: Context): boolean
self.myBlob = context:blob('myBlob')

if self.myBlob then
print('Blob data buffer:', self.myBlob.data)
end

return true
end

return function(): Node<DrawBlob>
return {
myBlob = nil,
init = init,
}
end